# -*- coding: utf-8 -*-
import json

import requests

# data = {"b":{"bizVersion":"17","cityUrl":"shenzhen","cityName":"深圳","fromDate":"2020-10-22","toDate":"2020-10-23","q":"","qFrom":3,"start":0,"num":20,"minPrice":0,"maxPrice":-1,"level":"","sort":0,"cityType":1,"fromForLog":1,"uuid":"","userName":"","userId":"","searchType":0,"hourlyRoom":False,"locationAreaFilter":[],"comprehensiveFilter":[],"vtoken":"pclist-v1-89412dc54851e3f68e034ceba77df341","channelId":1}}
# payloadHeader = {
#     'Content-Type': 'application/json',
# }
# r =requests.post("http://hotel.qunar.com/napi/list", json=json.dumps(data), headers=payloadHeader)
# print(r.content.decode())


url = "https://m.ctrip.com/restapi/soa2/16709/json/HotelSearch?testab=d66434f8a47c08be4878841b1f81d6a88295cfba6db36f220bc8fff23106abd8"
# url = "https://m.ctrip.com/restapi/soa2/16709/json/HotelSearch"
data = {"meta":{"fgt":"","hotelId":"","priceToleranceData":"","priceToleranceDataValidationCode":"","mpRoom":[],"hotelUniqueKey":"","shoppingid":"","minPrice":"","minCurr":""},"seqid":"","deduplication":[66684700,2622151,61616470,426206,63448967,29801129,67690986,52682020,54499290,48702888,29520377,457383],"filterCondition":{"star":[],"rate":"","rateCount":[],"priceRange":{"lowPrice":0,"highPrice":-1},"priceType":"","breakfast":[],"payType":[],"bedType":[],"bookPolicy":[],"bookable":[],"discount":[],"zone":[],"landmark":[],"metro":[],"airportTrainstation":[],"location":[],"cityId":[],"amenty":[],"promotion":[],"category":[],"feature":[],"brand":[],"popularFilters":[],"hotArea":[],"ctripService":[]},"searchCondition":{"sortType":"1","adult":1,"child":0,"age":"","pageNo":2,"optionType":"City","optionId":"30","lat":0,"destination":"","keyword":"","cityName":"深圳","lng":0,"cityId":30,"checkIn":"2020-11-02","checkOut":"2020-11-03","roomNum":1,"mapType":"gd","travelPurpose":0,"countryId":1,"url":"https://hotels.ctrip.com/hotels/listPage?cityename=shenzhen&city=30&optionId=30&optionType=City&checkin=2020/11/2&checkout=2020/11/03&crn=1&adult=1&children=0#abtest=200820_HTL_cdhwp:B;","pageSize":10,"timeOffset":28800,"radius":0,"directSearch":0,"signInHotelId":0,"signInType":0},"queryTag":"NORMAL","genk":True,"genKeyParam":{"a":0,"b":"2020-11-02","c":"2020-11-03","d":"zh-cn","e":2},"webpSupport":True,"platform":"online","pageID":"102002","head":{"Version":"","userRegion":"CN","Locale":"zh-CN","LocaleController":"zh-CN","TimeZone":"8","Currency":"CNY","PageId":"102002","webpSupport":True,"userIP":"","P":"75571333477","ticket":"","clientID":"1603222407883.1y9e2k","group":"ctrip","Frontend":{"vid":"1603222407883.1y9e2k","sessionID":11,"pvid":70},"Union":{"AllianceID":"","SID":"","Ouid":""},"HotelExtension":{"group":"CTRIP","hasAidInUrl":False,"Qid":"658747528929","WebpSupport":True,"hotelUuidKey":"8O4x0PifPeTAE79RtYgHYfcELYXkez1Ec7jh3WqYd7rSpIZzjGhxnY1bWQZxpgvFLw3YpajOQyLle8ZWHYalvnHYSAyQsjnLvz5etAYkdjf1ypYZ9vHPYBHWF3wZOjqOep4ioZY6YBYG3vLleTNYFLiqOYlYdY6GIsbWdYG6YmBiD4ig9iOXjGYSawkAEgkYHlwXOEUPJA8YpPwPYOaRpDwdbWPLEG6iStY56R1ZyokyqpYnNipZi7oRzY6DRcfwZQIXXxODjS6jOzenfjzHiffxPOip3YUGEpdyn7W9hJ3YX1RHgw9zWfUi6aYkfYdzYHoE89Wa3ynfjbsjgniGY61j86wLfvZ3j9YB6Rt3JPDiGgwczekhj7FwBhEFYfhRd6J0PiBowT6ef4jMFY0BE6YLMRFfwzFWgqE97i3qYtGRM6JSMJQ4jkbRcoWlm"}}}
headers={
    'content-type': 'application/json;charset=UTF-8',
    'accept-encoding': 'gzip, deflate, br',
    'p': '75571333477',
    'origin': 'https://hotels.ctrip.com',
    'referer': 'https://hotels.ctrip.com/hotels/listPage?cityename=shenzhen&city=30&optionId=30&optionType=City&checkin=2020/11/2&checkout=2020/11/03&crn=1&adult=1&children=0',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36',
    # ':authority': 'm.ctrip.com',
    # ':method': 'POST',
    # ':path': '/restapi/soa2/16709/json/HotelSearch?testab=d66434f8a47c08be4878841b1f81d6a88295cfba6db36f220bc8fff23106abd8',
    # ':scheme': 'https'
}
proxies = {
    # "https": "https://221.122.91.76:9480",
    # "https": "https://171.12.115.95:9999",
    # "https": "https://122.5.97.101:9999",
    "https": "https://183.166.138.8:3000",
    # "https": "https://171.35.146.229:9999",
    # "https": "https://115.218.214.92:8118",
    # "https": "https://110.229.159.227:9999",
    # "https": "https://123.55.114.68:9999",
    # "https": "https://222.94.150.101:3128",

    # "http": "http://112.47.3.53:3128",
    # "http": "http://222.84.172.139:8118",
}
res = requests.post(url, data=json.dumps(data), headers=headers, proxies=proxies).content.decode()
print(res)
